<?php
function zfleft($ar)
{
    global $cache,$cachetime,$dpid,$dcid,$config,$db,$tpl;
    //useCahe();
	$flag=md5(implode(",",$ar));
	$tmpdir=$config['webroot']."/templates/".$config['temp']."/label/".$ar['temp'].".htm";
	if(file_exists($tmpdir))
		$tpl->template_dir = $config['webroot']."/templates/".$config['temp']."/label/";
	else
		$tpl->template_dir = $config['webroot']."/templates/default/label/";
	
	
	if(!$tpl->is_cached($ar['temp'].".htm",$flag))
	{
		$limit=empty($ar['limit'])?1:$ar['limit'];	        //����
		$num=empty($ar['num'])?0:$ar['num'];	       	    
		$leng=$ar['leng'];                         			//�ַ���
		$keyboard=$ar['keyboard'];                         	//�ؼ���
		$key=$ar['key'];                         	        //�ؼ���
		$user=$ar['user'];	  					   			//$user:�Ƿ���û�Ա����
		$uid=$ar['userid'];	                        		//����ID��Ա������
		$tj=$ar['rec'];			                    		//�Ƿ��Ƽ�
		$top=$ar['top']; 									//�Ƿ�ͷ��
		$catid=$ar['catid'];	                   			//�������ɣ�
		$catname=$ar['catname'];                   			//�����
		$img=$ar['img'];		               				//���ű���ͼƬ
		$order=$ar['order'];		           			    //���÷�ʽ
		$oth=$ar['oth'];
		$flash=$ar['flash'];								//�Ƿ����flash
		$width=empty($ar['width'])?100:$ar['width'];        //���
   	    $height=empty($ar['height'])?100:$ar['height'];     //�߶�
		
		
		$sql="SELECT * FROM tuliao_exhibition WHERE pic<>'' ORDER BY id DESC  limit $num,$limit";

		$db->query($sql);
		$re=$db->getRows();
		foreach($re as $key=>$val)
		{
			
			if($flash)
			{
				if(file_exists($config['webroot']."/uploadfile/exhibitimg/".$val['pic'].'.jpg')){
					@$sst[]=str_replace("'","��",$val['title']);
					@$ssp[]=urlencode($config['weburl'].'/uploadfile/exhibitimg/'.$val['pic'].'.jpg');
					@$ssl[]=urlencode($config['weburl'].'/?m=exhibition&s=exhibition_detail&id='.$val['id']);
				}
			}
		}		
		
		if($flash)
	    {
			@$tpl->assign("files",implode("|",$ssp));
			@$tpl->assign("links",implode("|",$ssl));
			@$tpl->assign("texts",implode("|",$sst));
			$tpl->assign("height",$height);
			$tpl->assign("width",$width);
		}
		
		//=======================================================
		$tpl->assign("config",$config);
		$tpl->assign("news",$re);
		$tpl->assign("leng",$leng);		
	}
	
    return $tpl->fetch($ar['temp'].'.htm',$flag);
}